package com.burnerpat.fl2d.core.weapon;

import com.burnerpat.fl2d.core.entity.*;
import com.burnerpat.fl2d.core.shape.Shape;
import com.burnerpat.fl2d.core.ship.Ship;
import com.burnerpat.fl2d.math.Vector2D;

public class Bullet extends DynamicEntity
{
	private double damage;
	private Ship owner;	
	
	public Bullet(Vector2D position, Vector2D speed, Ship pOwner, double pDamage, long pLifetime)
	{
		super(Entity.AUTO, position, speed.getAngle(), speed, pLifetime, Shape.DOT);
		owner = pOwner;
		damage = pDamage;
	}
	
	public double getDamage()
	{
		return damage;
	}
	
	public Ship getOwner()
	{
		return owner;
	}
	
	public boolean checkHit(PhysicalEntity other)
	{
		if (this.intersects(other))
		{
			die();
			return true;
		}
		else
		{
			return false;
		}
	}
}
